package Test;

//客户端（测试类）

public class Client {
    public static void main(String[] args) {

        //创建被代理类对象
        UserDAOImpl conreteUserDAO = new UserDAOImpl();


        //和被代理类实现同个接口方式进行代理
        System.out.println("共同实现接口方式");
        UserDAOProxyByInterface userDAOProxyByInterface = new UserDAOProxyByInterface(conreteUserDAO);
        String s = userDAOProxyByInterface.insert("小明", 18);
        System.out.println(s);
        System.out.println("---------------------------------------------------");



        //通过继承被代理类方式进行代理
        System.out.println("继承方式");
        UserDAOProxyByExtend userDAOProxyByExtend = new UserDAOProxyByExtend(conreteUserDAO);
        String s1 = userDAOProxyByExtend.insert("小明", 18);
        System.out.println(s1);
    }
}
